/** @file Storage.h
	@brief Definition of parent classes for storage working.
 */

#ifndef __storage_h__
#define __storage_h__

#include <cstddef>

#include "exception.h"

/////////////////////////////////////////////////
/// Parent class for storage objects.
/////////////////////////////////////////////////
class StorageObject_t {
public:
		/// Destructor.
		virtual ~StorageObject_t() {}

		/// Set object state.
		/// @exception std::invalid_argument there is wrong state
		virtual void set_state(const char * _state, size_t _size) throw(std::bad_alloc, std::invalid_argument) = 0;

		/// Get object state.
		/// @exception std::invalid_argument current state can't be store
		virtual void get_state(char * & _state, size_t & _size) const throw(std::bad_alloc, std::invalid_argument) = 0;
};

/////////////////////////////////////////////////
/// Parent class for storage.
/////////////////////////////////////////////////
class Storage_t {
public:
		/// Destructor.
		virtual ~Storage_t() {}

		/// Store object state with specifien key.
		virtual void set(const char * _key, const StorageObject_t * _obj) = 0;

		/// Get object state with specifien key.
		virtual void get(const char * _key, StorageObject_t * _obj) = 0;
};

#endif //__storage_h__
